package
{
	import com.demonsters.debugger.MonsterDebugger;
	
	import events.NavigationEvent;
	
	import screens.InGame;
	import screens.Welcome;
	
	import starling.display.Sprite;
	import starling.events.Event;

	public class Game extends Sprite
	{
		
		private var screenWelcome:Welcome;
		
		private var screenInGame:InGame;
		
		public function Game()
		{
			super();
			this.addEventListener(Event.ADDED_TO_STAGE,onAddedToStageHandler);
		}
		
		private function onAddedToStageHandler(e:Event):void
		{
			this.addEventListener(NavigationEvent.CHANGE_SCREEN,onChangeScreenHandler);
			
			screenInGame=new InGame();
			screenInGame.disposeTemporarily();
			this.addChild(screenInGame);
			
			screenWelcome=new Welcome();
			this.addChild(screenWelcome);
			
			
			screenWelcome.initialize();
		}
		
		private function onChangeScreenHandler(e:NavigationEvent):void
		{
			switch(e.params.id)
			{
				case "play":
					screenWelcome.disposeTemporarily();
					screenInGame.initialize();
					break;
				
				default:
					break;
			}
		}		
		
	}
}